#ifndef DRC_H
#define DRC_H

#include "Arduino.h"
class DRC {
	public:
	DRC(float fs, float T,float tauAtt,float tauRel, float R,float w, float mu);
	int16_t softKnee(float x);
	
	private:
	float log10f_approx(float X);
	float _T;
    float _alphAtt;
	float _alphRel;
	float _slope;
	float _yprev;
	float _w; 
	float _mu;
	float _w4;	 
	
};
static const float G[193]={0.00001585f, 0.00001778f, 0.00001995f, 0.00002239f, 0.00002512f, 0.00002818f, 0.00003162f, 0.00003548f, 0.00003981f, 0.00004467f, 0.00005012f, 0.00005623f, 0.00006310f, 0.00007079f, 0.00007943f, 0.00008913f, 0.00010000f, 0.00011220f, 0.00012589f, 0.00014125f, 0.00015849f, 0.00017783f, 0.00019953f, 0.00022387f, 0.00025119f, 0.00028184f, 0.00031623f, 0.00035481f, 0.00039811f, 0.00044668f, 0.00050119f, 0.00056234f, 0.00063096f, 0.00070795f, 0.00079433f, 0.00089125f, 0.00100000f, 0.00112202f, 0.00125893f, 0.00141254f, 0.00158489f, 0.00177828f, 0.00199526f, 0.00223872f, 0.00251189f, 0.00281838f, 0.00316228f, 0.00354813f, 0.00398107f, 0.00446684f, 0.00501187f, 0.00562341f, 0.00630957f, 0.00707946f, 0.00794328f, 0.00891251f, 0.01000000f, 0.01122018f, 0.01258926f, 0.01412538f, 0.01584893f, 0.01778279f, 0.01995262f, 0.02238721f, 0.02511886f, 0.02818383f, 0.03162277f, 0.03548133f, 0.03981072f, 0.04466835f, 0.05011873f, 0.05623413f, 0.06309573f, 0.07079458f, 0.07943282f, 0.08912510f, 0.10000000f, 0.11220185f, 0.12589255f, 0.14125374f, 0.15848932f, 0.17782794f, 0.19952624f, 0.22387213f, 0.25118864f, 0.28183830f, 0.31622776f, 0.35481340f, 0.39810717f, 0.44668359f, 0.50118721f, 0.56234133f, 0.63095737f, 0.70794576f, 0.79432821f, 0.89125097f, 1.00000000f, 1.12201846f, 1.25892544f, 1.41253757f, 1.58489323f, 1.77827942f, 1.99526238f, 2.23872113f, 2.51188660f, 2.81838274f, 3.16227770f, 3.54813409f, 3.98107195f, 4.46683550f, 5.01187229f, 5.62341309f, 6.30957365f, 7.07945824f, 7.94328213f, 8.91250896f, 10.00000000f, 11.22018337f, 12.58925438f, 14.12537479f, 15.84893322f, 17.78279495f, 19.95262146f, 22.38721275f, 25.11886215f, 28.18383217f, 31.62277603f, 35.48133469f, 39.81071854f, 44.66835785f, 50.11872864f, 56.23413086f, 63.09572601f, 70.79458618f, 79.43281555f, 89.12510681f, 100.00000000f, 112.20183563f, 125.89251709f, 141.25378418f, 158.48933411f, 177.82794189f, 199.52621460f, 223.87207031f, 251.18870544f, 281.83831787f, 316.22778320f, 354.81335449f, 398.10708618f, 446.68368530f, 501.18728638f, 562.34130859f, 630.95727539f, 707.94561768f, 794.32843018f, 891.25103760f, 1000.00000000f, 1122.01831055f, 1258.92517090f, 1412.53784180f, 1584.89331055f, 1778.27941895f, 1995.26208496f, 2238.72070312f, 2511.88696289f, 2818.38330078f, 3162.27758789f, 3548.13354492f, 3981.07080078f, 4466.83691406f, 5011.87304688f, 5623.41308594f, 6309.57275391f, 7079.45605469f, 7943.28417969f, 8912.51074219f, 10000.00000000f, 11220.18945313f, 12589.25195313f, 14125.37890625f, 15848.92480469f, 17782.79492187f, 19952.63281250f, 22387.20703125f, 25118.86914062f, 28183.81640625f, 31622.77734375f, 35481.35546875f, 39810.70703125f, 44668.36718750f, 50118.70312500f, 56234.13281250f, 63095.76171875f};
#endif